/****************************************************************************
 *
 *  ALi (Shanghai) Corporation, All Rights Reserved. 2002 Copyright (C)
 *
 *  File: UpgradeInterface.h
 *
 *  Description: define variables and functions interface about upgrade module
 *		         
 *  History:
 *      Date		Author      Version		Comment
 *      ====        ======      =======		=======
 *  1   2007.5.23	Tony Wang	1.0			Create
 ****************************************************************************/


#ifndef __UPGRADEINTERFACE_H__
#define __UPGRADEINTERFACE_H__


#include "CommDefine.h"

#ifdef __cplusplus
extern "C"
{
#endif
/********************************* Macro and Struct Define *********************************/
/****************************************************************************
 *
 *  Name:		SetProtocolVersion()
 *	Function:	Set Client tools(Boot Loader) protocol version
 *	variable:	nProtocolVersion
 *				
 *				
 *  
 ****************************************************************************/
void SetProtocolVersion(UINT32 nProtocolVersion);
/********************************* Function Define *********************************/
/****************************************************************************
 *
 *  Name:		cmd_comtest
 *	Function:	test serial port communication
 *	variable:	pfProgress 		-- callback function about progress
 *				pfUserAbort 	-- callback function about if user abort thread
 *				
 *  
 ****************************************************************************/
UINT32 cmd_comtest(UINT32 *pVersion, CALLBACK_PROGRESS pfProgress,  CALLBACK_USERABORT pfUserAbort);

/****************************************************************************
 *
 *  Name:		cmd_version
 *	Function:	command version return chunk info
 *	variable:	chunk_info 		-- chunk info about command version return
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_version(UINT32 *pVersion);

	
/****************************************************************************
 *
 *  Name:		cmd_address
 *	Function:	set start address
 *	variable:	addr -- start address
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_address(UINT32 addr); 
/****************************************************************************
 *
 *  Name:		cmd_move
 *	Function:	move chunk
 *	variable:	index -- chunk index
 *				offset - chunk offset
 *				
 *  
 ****************************************************************************/
UINT32 cmd_move(UINT32 index,UINT32 offset);	

/****************************************************************************
 *
 *  Name:		cmd_transfer
 *	Function:	move chunk
 *	variable:	buffer - data buffer for transfer
 *				nBufLen	-- buffer len
 *				pfProgress 		-- callback function about progress
 *				pfUserAbort 	-- callback function about if user abort thread
 *  
 ****************************************************************************/
UINT32 cmd_transfer(unsigned char *buffer, int nBufLen, 
		CALLBACK_PROGRESS pfProgress,  CALLBACK_USERABORT pfUserAbort);

/****************************************************************************
 *
 *  Name:		cmd_burn
 *	Function:	burn flash
 *	variable:	pfProgress 		-- callback function about progress
 *				
 *								
 *  
 ****************************************************************************/
UINT32 cmd_burn(int nBurnSize, CALLBACK_PROGRESS pfProgress, BOOL bCareReturn);

/****************************************************************************
 *
 *  Name:		cmd_burn_ext
 *	Function:	burn flash, with user abort
 *	variable:	pfProgress 		-- callback function about progress
 *				
 *								
 *  
 ****************************************************************************/
UINT32 cmd_burn_ext(int nBurnSize, CALLBACK_PROGRESS pfProgress, BOOL bCareReturn,  CALLBACK_USERABORT pfUserAbort);

/****************************************************************************
 *
 *  Name:		cmd_reboot
 *	Function:	reboot target
 *	variable:	
 *				
 *				
 *  
 ****************************************************************************/
UINT32 cmd_reboot();
#ifdef __cplusplus
}
#endif		/*	__cplusplus		*/

#endif	/* __UPGRADEINTERFACE_H__ */
